#Phase 3 part of the code
Phase3Intro:
.asciiz "Congratulations, despite our best efforts you have successfully made it to phase 3.\nPhase 3 is the Integration portion of the class, where the verilog code from the entire class comes together and forms a working processor.\n\nBecause you have managed to reach phase 3 you have unlocked the prestige classes. You must now choose from one of 4 new prestige classes.\n1. Integration\n2. Demo\n3. Video\n4. Documentation" 

integrationIntro:
.asciiz "May God hath pitty on your soul, for you are now an Integration Overlord. Your job, should you choose to accept it, will be to take the crap code presented to you by the rest of the class and produce a working processor.\nIntelligence+20\nUnderstanding of MIPs+100\nLife-20\nGrade+20 (applies to entiire class)\nSleep-30"

IntegrationMonday:
.asciiz "\nIts Monday night,"

IntegrationWednesday:
.asciiz "\nIts Wednesday night,"

IntegrationThursday:
.asciiz "\nIts Thursday night," 

IntegrationFriday:
.asciiz "\nIts Friday night,"

IntegrationSaturday:
.asciiz "\nIts Saturday night,"

IntegrationGen:
.asciiz " first week of Phase 3, what are you doing?\n1. Working in the Lab\n2. Working in the Lab\n3. Working in the Lab\n4. Working in the Lab"

IntegrationTuesday:
.asciiz "\nIts Tuesday night, first week of Phase 3, what are you doing?\n1. Working in the Lab\n2. Working in the Lab\n3. Working in the Lab\n4. Going home" 

false:
.asciiz "\nNo you're not, get back in the lab." 

yesterday:
.asciiz "\nYesterday...\nIt was Thursday...\nHowever, today it is:"

Friday:
.asciiz "\nFriday"

vidString1:
.asciiz "\nWant to make a video over Computer Architecture?\n1. Yes\n2. No"

vidYes:
.asciiz "\nAlright have you thought about using that cool new Rebecca Black song Friday?\n1. Yes, I love that song!\n2. No I hate it"

vidNo:
.asciiz "\nToo bad, you have to make the video to pass the class.\nNow you have to include Rebecca Black's Friday in your video."

vidYes2a:
.asciiz "\nAwesome now go make the video and annoy as much of the class as possible in doing it."

vidYes2b:
.asciiz "\nNo Friday... No Pass... Go to Start"


phase3_start:

#Random Encounter
	jal combat_coinflip
	nop

	li $a0, Phase3Intro
	jal libplp_uart_write_string
	nop

	# Integration
	move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, integration1
	nop
	# Demo
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, demo1
	nop
	#Video
	move $t0, $v0
	li $t1, 0x00000034
	beq $t0, $t1, vid1
	nop
	# Documentation
	move $t0, $v0
	li $t1, 0x00000035
	beq $t0, $t1, document1
	nop
	
integration1:

	#Random Event
	jal combat_coinflip
	nop
	
	li $a0, integrationIntro
	jal libplp_uart_write_string
	nop
	li $a0, IntegrationMonday
	jal libplp_uart_write_string
	nop
	li $a0, IntegrationGen
	jal libplp_uart_write_string
	nop
		
	move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, integration2
	nop
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, integration2
	nop
	move $t0, $v0
	li $t1, 0x00000034
	beq $t0, $t1, integration2
	nop
	move $t0, $v0
	li $t1, 0x00000035
	beq $t0, $t1, integration2
	nop
	
integration2:

	#Random Event
	jal combat_coinflip
	nop
	
	li $a0, IntegrationTuesday
	jal libplp_uart_write_string
	nop
	
	move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, integration3
	nop
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, integration3
	nop
	move $t0, $v0
	li $t1, 0x00000034
	beq $t0, $t1, integration3
	nop
	move $t0, $v0
	li $t1, 0x00000035
	beq $t0, $t1, integration3a
	nop
	
integration3a:
	li $a0, false
	jal libplp_uart_write_string
	nop
	j integration3
	nop
	
integration3:

	#Random Event
	jal combat_coinflip
	nop

	li $a0, IntegrationWednesday
	jal libplp_uart_write_string
	nop
	li $a0, IntegrationGen
	jal libplp_uart_write_string
	nop
		move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, integration4
	nop
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, integration4
	nop
	move $t0, $v0
	li $t1, 0x00000034
	beq $t0, $t1, integration4
	nop
	move $t0, $v0
	li $t1, 0x00000035
	beq $t0, $t1, integration4
	nop
	
integration4:

	#Random Event
	jal combat_coinflip
	nop

	li $a0, IntegrationThursday
	jal libplp_uart_write_string
	nop
	li $a0, IntegrationGen
	jal libplp_uart_write_string
	nop
		move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, integration5
	nop
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, integration5
	nop
	move $t0, $v0
	li $t1, 0x00000034
	beq $t0, $t1, integration5
	nop
	move $t0, $v0
	li $t1, 0x00000035
	beq $t0, $t1, integration5
	nop	

integration5:

	#Random Event
	jal combat_coinflip
	nop

	li $a0, IntegrationFriday
	jal libplp_uart_write_string
	nop
	li $a0, IntegrationGen
	jal libplp_uart_write_string
	nop
		move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, integration6
	nop
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, integration6
	nop
	move $t0, $v0
	li $t1, 0x00000034
	beq $t0, $t1, integration6
	nop
	move $t0, $v0
	li $t1, 0x00000035
	beq $t0, $t1, integration6
	nop

integration6:

	#Random Event
	jal combat_coinflip
	nop

	li $a0, IntegrationSaturday
	jal libplp_uart_write_string
	nop
	li $a0, IntegrationGen
	jal libplp_uart_write_string
	nop
	move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, integration4
	nop
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, integration4
	nop
	move $t0, $v0
	li $t1, 0x00000034
	beq $t0, $t1, integration4
	nop
	move $t0, $v0
	li $t1, 0x00000035
	beq $t0, $t1, integration4
	nop
	
vid1:
	
	#Random Event
	jal combat_coinflip
	nop
	
	li $a0, yesterday
	jal libplp_uart_write_string
	nop
	
FridayLoop:
	li $a0, Friday
	li $t1, 0x00000064
	li $t0, 0x00000000
	jal libplp_uart_write_string
	nop
	beq $t0, $t1 vidQuestion1
	addi $t0, $t0, 0x00000001
	bne $t0, $t1, FridayLoop
	nop
	
vidQuestion1:
	
	#Random Event
	jal combat_coinflip
	nop

	#Want to make a video for Comp Arch?	
	li $a0, vidString1
	jal libplp_uart_write_string
	nop

	move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, vidQ1Yes
	nop
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, vidQ1No
	nop

vidQ1Yes:
	li $a0, vidYes
	jal libplp_uart_write_string
	nop

	move $t0, $v0
	li $t1, 0x00000031
	beq $t0, $t1, vidQ2Yes
	nop
	move $t0, $v0
	li $t1, 0x00000032
	beq $t0, $t1, vidQ2No
	nop

vidQ1No:
	li $a0, vidNo
	jal libplp_uart_write_string
	nop
	j writevid
	nop

vidQ2Yes:
	li $a0, vidYes2a
	jal libplp_uart_write_string
	nop
	j writevid
	nop
	
vidQ2No:
	li $a0, vidYes2b
	jal libplp_uart_write_string
	nop
	j start
	nop

	
	